home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Whiteline: delta
/
whiteline CD Series - delta.iso
/
progtool
/
modula2
/
module
/
menuevnt.mod
< prev
next >
Wrap
Text File
|
1995-11-25
|
12KB
|
331 lines
IMPLEMENTATION MODULE MenuEvnt;
FROM SYSTEM IMPORT VAL,ADDRESS;
FROM MindMachine IMPORT HaraldWessbacher,LutzMehlhorn,MidsummerNight,
EarthHarmonie,FrequenzGangARRAY,Change,
RuhevolleWachheit,AllgBenutzung,Anregung;
FROM EasyDialog IMPORT DoMoveDialog,and,GetText,SetText,IsSelected;
FROM AES IMPORT FormAlert,GrafMouse,MenuTitleNormal,ResourceGetAddr,
MenuItemEnable,ObjectChange;
FROM GEMAESbase IMPORT HourGlass,Arrow,Selected,Normal,RTree;
FROM ConvertStr IMPORT StrToInt,IntToStr;
FROM Liste IMPORT SetValue,GetValue,EnterElement, AppendElement,Next,
Prev,AtFirst,First,AtLast,Empty,RemoveElement,KillList,
MakeList;
FROM MathLib0 IMPORT sqrt;
FROM Mathbase IMPORT real,entier;
FROM RealInOut IMPORT WriteReal;FROM InOut IMPORT WriteInt;
FROM MBIO IMPORT MBList,LoadList,SaveList,RunExtern,MergeList;
VAR String : ARRAY [1..160]OF CHAR;
ENDE : BOOLEAN;
ResultArray : FrequenzGangARRAY;
EditAdresse :ADDRESS;
VAR StepXofN :INTEGER;
PROCEDURE Dauer(FreqGang: FrequenzGangARRAY ): INTEGER;
VAR Zaehler : INTEGER;
f1,f2 : LONGINT;
DaueR,
MittelFrequenz : REAL;
BEGIN
IF (FreqGang[1] = FreqGang[2]) OR (FreqGang[3] =0) THEN
RETURN FreqGang[3];
ELSE
MittelFrequenz := sqrt(real(FreqGang[1]) * real(FreqGang[2]));
f1:= 50000D DIV VAL(LONGINT, FreqGang[1]);
f2:= 50000D DIV VAL(LONGINT, FreqGang[2]);
Zaehler:=0;
DaueR:=0.0;
END(*IF*);
IF FreqGang[1]<FreqGang[2] THEN (*Up*)
REPEAT
Zaehler:= Zaehler+1;
(* FreqGang[1]:=FreqGang[1]+FreqGang[3];*)
f1:=f1-VAL(LONGINT,FreqGang[3]);
UNTIL f1<=f2;
ELSIF FreqGang[1]>FreqGang[2] THEN (*down*)
REPEAT
Zaehler:= Zaehler+1;
(*FreqGang[1]:=FreqGang[1]-FreqGang[3];*)
f1:=f1+VAL(LONGINT,FreqGang[3]);
UNTIL f1>=f2;
END(*IF*);
DaueR:= real(Zaehler)*2.0/MittelFrequenz;
WriteInt( entier (DaueR),10);
RETURN entier (DaueR);
END Dauer;
PROCEDURE GetDialogResult(VAR Result :FrequenzGangARRAY);
VAR String :ARRAY [0..1] OF CHAR;
OK :BOOLEAN;
l :INTEGER;
PROCEDURE ButtonToInt(First,Last:INTEGER):INTEGER;
VAR i,j,k :INTEGER;
BEGIN
j:=1;
k:=0;
FOR i := First TO Last DO
IF IsSelected(i,EditAdresse) THEN
k:= k+j;
END(*IF*);
j:= j*2;
END(*FOR*);
RETURN k;
END ButtonToInt;
BEGIN
GetText(ANFREQ,EditAdresse, String);
StrToInt(String,Result[1],OK);
GetText(ENDFREQ,EditAdresse, String);
StrToInt(String,Result[2],OK);
GetText(GESCHWIN,EditAdresse, String);
StrToInt(String,Result[3],OK);
Result[4]:=ButtonToInt(A1,A8);
Result[5]:=ButtonToInt(B1,B8);
Result[6]:=ButtonToInt(C1,C8);
Result[7]:=ButtonToInt(D1,D8);
Result[9]:=StepXofN;
Result[10]:=Dauer(Result);
END GetDialogResult;
PROCEDURE SetDialogResult(VAR Result :FrequenzGangARRAY);
VAR String :ARRAY [0..2] OF CHAR;
StepStr:ARRAY [0..4] OF CHAR;
OK :BOOLEAN;
l :INTEGER;
PROCEDURE IntToButton(First,Last,Res:INTEGER);
VAR i,j,k :INTEGER;
BEGIN
j:=1;
k:=0;
FOR i := First TO Last DO
k:=k+j;
IF and(k,Res ) THEN
ObjectChange(EditAdresse,i,0,1,2,3,4,Selected,1);
Res:=Res-j;
ELSE
ObjectChange(EditAdresse,i,0,1,2,3,4,Normal,1);
END(*IF*);
j:= j*2;
END(*FOR*);
END IntToButton;
BEGIN
IntToStr(Result[1],2,String,OK);
String[0]:=String[1]; String[1]:=String[2]; String[2]:=0C;
SetText(ANFREQ,EditAdresse, String);
IntToStr(Result[2],2,String,OK);
String[0]:=String[1]; String[1]:=String[2]; String[2]:=0C;
SetText(ENDFREQ,EditAdresse, String);
IntToStr(Result[3],2,String,OK);
String[0]:=String[1]; String[1]:=String[2]; String[2]:=0C;
SetText(GESCHWIN,EditAdresse, String);
IntToButton(A1,A8, Result[4]);
IntToButton(B1,B8, Result[5]);
IntToButton(C1,C8, Result[6]);
IntToButton(D1,D8, Result[7]);
IntToStr(Result[9],3,StepStr,OK);
StepStr[0]:=StepStr[1]; StepStr[1]:=StepStr[2];
StepStr[2]:=StepStr[3]; StepStr[3]:=StepStr[4]; StepStr[4]:=0C;
SetText(STEPXOFN,EditAdresse, StepStr);
IntToStr(Result[10],2,StepStr,OK);
IF OK THEN
StepStr[0]:=StepStr[1]; StepStr[1]:=StepStr[2];
StepStr[2]:=StepStr[3]; StepStr[3]:=StepStr[4]; StepStr[4]:=0C;
SetText(DAUER,EditAdresse, StepStr);
END(*IF*);
END SetDialogResult;
PROCEDURE Editiere;
VAR formret:INTEGER;
I:INTEGER; Done:BOOLEAN;
NullResultArray : FrequenzGangARRAY;
BEGIN
FOR I:= 1 TO 10 DO NullResultArray[I]:=0 END(*FOR*);
formret:=0;
IF ~Empty(MBList) THEN
First(MBList);
Done:=GetValue(MBList,ResultArray);
SetDialogResult(ResultArray);
ELSE
GetDialogResult(ResultArray);
END(*IF*);
WHILE formret#OKAY DO
formret:=DoMoveDialog(EditAdresse,ANFREQ);
IF (formret#CANCEL) THEN
GetDialogResult(ResultArray);
IF (formret=NEXT) THEN
IF AtLast(MBList)THEN
AppendElement(MBList);
SetValue(MBList,ResultArray);
NullResultArray[1]:=ResultArray[2];
SetDialogResult(NullResultArray);
ELSE
SetValue(MBList,ResultArray);
Next(MBList);
Done:=GetValue(MBList,ResultArray);
SetDialogResult(ResultArray);
END(*IF*);
ELSIF (formret=PREVIOUS) THEN
IF AtFirst(MBList)THEN
EnterElement(MBList);
SetValue(MBList,ResultArray);
SetDialogResult(NullResultArray);
ELSIF AtLast(MBList)THEN
AppendElement(MBList);
SetValue(MBList,ResultArray);
Prev(MBList); Prev(MBList);
Done:=GetValue(MBList,ResultArray);
SetDialogResult(ResultArray);
ELSE
SetValue(MBList,ResultArray);
Prev(MBList);
Done:=GetValue(MBList,ResultArray);
SetDialogResult(ResultArray);
END(*IF*);
ELSIF formret=DELETE THEN
RemoveElement(MBList);
Done:=GetValue(MBList,ResultArray);
SetDialogResult(ResultArray);
ELSIF formret=INSERT THEN
EnterElement(MBList);
SetValue(MBList,ResultArray);
END(*IF*);
ELSE (* Formret = CANCEL *)
SetDialogResult(ResultArray);
END(*IF*);
END(*WHILE*);
END Editiere;
PROCEDURE Teste;
VAR formret:INTEGER;
BEGIN
formret:=DoMoveDialog(EditAdresse,ANFREQ);
IF formret= OKAY THEN
GetDialogResult(ResultArray);
Change(ResultArray);
END(*IF*);
END Teste;
PROCEDURE MenueEreignis(msgret:INTEGER;menueadresse:ADDRESS):BOOLEAN;
VAR formret,fsel:INTEGER;
SoundDiaAdrr : ADDRESS;
AboutAdresse,BuecherAdresse,ContraAdresse,
HardwAdresse :ADDRESS;
BEGIN
ResourceGetAddr(0,MBEDIT,EditAdresse);
ResourceGetAddr(RTree,ABOUTDIA,AboutAdresse);
ResourceGetAddr(RTree,LITERDIA,BuecherAdresse);
ResourceGetAddr(RTree,GEGENDIA,ContraAdresse);
ResourceGetAddr(RTree,HARDWDIA,HardwAdresse);
String :='[3][Ist Die Brille| angeschlossen ?][ OK |ABRUCH]';
ENDE:=FALSE;
CASE msgret OF
ABOUT : formret:=DoMoveDialog(AboutAdresse,0);
| QUIT : String :='[3][Wollen Sie das Programm| Verlassen ?][ OK |ABBRUCH]';
formret:=FormAlert(1,String);
IF formret = 1 THEN
ENDE := TRUE;
END(*IF*);
| EDIT : Editiere;
MenuItemEnable(menueadresse,XSESSION,1);
MenuItemEnable(menueadresse,VERLAUF,1)
| LOAD : LoadList;
MenuItemEnable(menueadresse,XSESSION,1);
MenuItemEnable(menueadresse,VERLAUF,1)
| SAVE : SaveList;
| MERGE : MergeList;
| NEW : KillList(MBList);
MakeList(MBList);
MenuItemEnable(menueadresse,XSESSION,0);
MenuItemEnable(menueadresse,VERLAUF,0)
| XSESSION : GrafMouse(HourGlass,menueadresse);
formret:=FormAlert(1,String);
IF formret = 1 THEN
RunExtern;
END(*IF*);
GrafMouse(Arrow,menueadresse);
| TEST : Teste;
| VERLAUF : String :='[0][ Verlauf| Not yet implemented | Christian Ledermann| ver 0.0 vom 25.02.93 ][ OK ]';
formret:=FormAlert(1,String);
| MIDSUMME : GrafMouse(HourGlass,menueadresse);
formret:=FormAlert(1,String);
IF formret = 1 THEN
MidsummerNight;
END(*IF*);
GrafMouse(Arrow,menueadresse);
| HYPNOSYN : GrafMouse(HourGlass,menueadresse);
formret:=FormAlert(1,String);
IF formret = 1 THEN
LutzMehlhorn;
END(*IF*);
GrafMouse(Arrow,menueadresse);
| HARALDW : GrafMouse(HourGlass,menueadresse);
formret:=FormAlert(1,String);
IF formret = 1 THEN
HaraldWessbacher;
END(*IF*);
GrafMouse(Arrow,menueadresse);
| EARTHHAR : GrafMouse(HourGlass,menueadresse);
formret:=FormAlert(1,String);
IF formret = 1 THEN
EarthHarmonie;
END(*IF*);
GrafMouse(Arrow,menueadresse);
| ALLGBENU : GrafMouse(HourGlass,menueadresse);
formret:=FormAlert(1,String);
IF formret = 1 THEN
AllgBenutzung;
END(*IF*);
GrafMouse(Arrow,menueadresse);
| RUHEWACH : GrafMouse(HourGlass,menueadresse);
formret:=FormAlert(1,String);
IF formret = 1 THEN
RuhevolleWachheit;
END(*IF*);
GrafMouse(Arrow,menueadresse);
| ANREGUNG : GrafMouse(HourGlass,menueadresse);
formret:=FormAlert(1,String);
IF formret = 1 THEN
Anregung;
END(*IF*);
GrafMouse(Arrow,menueadresse);
| HELP : String :='[0][ Hilfe| Not yet implemented | Christian Ledermann| ver 0.0 vom 25.02.93 ][ OK ]';
formret:=FormAlert(1,String);
| TON : String :='[0][ Ton| Not yet implemented | Christian Ledermann| ver 0.0 vom 25.02.93 ][ OK ]';
formret:=FormAlert(1,String);
ResourceGetAddr(0,SOUNDDIA,SoundDiaAdrr);
formret:= DoMoveDialog(SoundDiaAdrr,0);
| MAGNET : String :='[0][ Magnet| Not yet implemented | Christian Ledermann| ver 0.0 vom 25.02.93 ][ OK ]';
formret:=FormAlert(1,String);
| BUECHER : formret:=DoMoveDialog(BuecherAdresse,0);
| LEDS : String :='[0][ LEDs| Not yet implemented | Christian Ledermann| ver 0.0 vom 25.02.93 ][ OK ]';
formret:=FormAlert(1,String);
| HARDWARE : formret:=DoMoveDialog(HardwAdresse,0);
| GEGENANZ : formret:=DoMoveDialog(ContraAdresse,0);
ELSE
ENDE := FALSE;
END (*CASE*);
MenuTitleNormal(menueadresse,DATEI,1);
MenuTitleNormal(menueadresse,DESK,1);
MenuTitleNormal(menueadresse,SESSION,1);
MenuTitleNormal(menueadresse,EXTRAS,1);
MenuTitleNormal(menueadresse,OPTIONS,1);
RETURN ENDE;
END MenueEreignis;
END MenuEvnt.